{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "    number                 name   contry  last_number\n",
       "0        1     Bayern M¨¹nchen   Germany            6\n",
       "1        2      Manchester City  England            1\n",
       "2        3     Atl¨¦tico Madrid    Spain            3\n",
       "3        4  Paris Saint-Germain   France            1\n",
       "4        5          Real Madrid    Spain            3\n",
       "..     ...                  ...      ...          ...\n",
       "95      96      Athletic Bilbao    Spain           40\n",
       "96      97             CFR Cluj  Romania          125\n",
       "97      98               Rennes   France           61\n",
       "98      99         Atl¨¦tico PR   Brazil           12\n",
       "99     100               Monaco   France            3\n",
       "\n",
       "[100 rows x 4 columns]"
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>number</th>\n      <th>name</th>\n      <th>contry</th>\n      <th>last_number</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1</td>\n      <td>Bayern M¨¹nchen</td>\n      <td>Germany</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2</td>\n      <td>Manchester City</td>\n      <td>England</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>Atl¨¦tico Madrid</td>\n      <td>Spain</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>4</td>\n      <td>Paris Saint-Germain</td>\n      <td>France</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>5</td>\n      <td>Real Madrid</td>\n      <td>Spain</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>95</th>\n      <td>96</td>\n      <td>Athletic Bilbao</td>\n      <td>Spain</td>\n      <td>40</td>\n    </tr>\n    <tr>\n      <th>96</th>\n      <td>97</td>\n      <td>CFR Cluj</td>\n      <td>Romania</td>\n      <td>125</td>\n    </tr>\n    <tr>\n      <th>97</th>\n      <td>98</td>\n      <td>Rennes</td>\n      <td>France</td>\n      <td>61</td>\n    </tr>\n    <tr>\n      <th>98</th>\n      <td>99</td>\n      <td>Atl¨¦tico PR</td>\n      <td>Brazil</td>\n      <td>12</td>\n    </tr>\n    <tr>\n      <th>99</th>\n      <td>100</td>\n      <td>Monaco</td>\n      <td>France</td>\n      <td>3</td>\n    </tr>\n  </tbody>\n</table>\n<p>100 rows × 4 columns</p>\n</div>"
     },
     "metadata": {},
     "execution_count": 5
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "df = pd.read_csv(r'D:\\Project\\Exercise\\2021-01-20\\01.csv', sep=',',encoding='unicode_escape')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "    number                      name          contry  last_number\n",
       "0        1          Bayern M¨¹nchen          Germany          6.0\n",
       "1        2           Manchester City         England          1.0\n",
       "2        3          Atl¨¦tico Madrid           Spain          3.0\n",
       "3        4       Paris Saint-Germain          France          1.0\n",
       "4        5               Real Madrid           Spain          3.0\n",
       "5        6              Liverpool FC         England          2.0\n",
       "6        7                 Barcelona           Spain          5.0\n",
       "7        8               Inter Milan           Italy          7.0\n",
       "8        9                  Juventus           Italy          8.0\n",
       "9       10         Manchester United         England         10.0\n",
       "10      11                  AC Milan           Italy         13.0\n",
       "11      12    RasenBallsport Leipzig         Germany         23.0\n",
       "12      13                  Atalanta           Italy         38.0\n",
       "13      14                  FC Porto        Portugal          3.0\n",
       "14      15                   Sevilla           Spain          3.0\n",
       "15      16         Borussia Dortmund         Germany          4.0\n",
       "16      17               River Plate       Argentina          8.0\n",
       "17      18          Bayer Leverkusen         Germany         21.0\n",
       "18      19                Villarreal           Spain         40.0\n",
       "19      20            Ajax Amsterdam     Netherlands          6.0\n",
       "20      21         Tottenham Hotspur         England         11.0\n",
       "21      22                Chelsea FC         England         11.0\n",
       "22      23          Shakhtar Donetsk         Ukraine          2.0\n",
       "23      24  Borussia M?nchengladbach         Germany          8.0\n",
       "24      25                      Roma           Italy         12.0\n",
       "25      26                SSC Napoli           Italy         17.0\n",
       "26      27            Leicester City         England         77.0\n",
       "27      28                     Lazio           Italy          2.0\n",
       "28      29                      Lyon          France          6.0\n",
       "29      30                 Santos FC          Brazil         55.0\n",
       "30      31                   Benfica        Portugal          4.0\n",
       "31      32                 Palmeiras          Brazil         10.0\n",
       "32      33             Slavia Prague  Czech Republic         38.0\n",
       "33      34                   Rangers        Scotland        134.0\n",
       "34      35                     Lille          France         92.0\n",
       "35      36              Boca Juniors       Argentina          7.0\n",
       "36      37             Real Sociedad           Spain         23.0\n",
       "37      38       Eintracht Frankfurt         Germany         15.0\n",
       "38      39                   Al Ahly           Egypt         51.0\n",
       "39      40             PSV Eindhoven     Netherlands         21.0\n",
       "40      41         Red Bull Salzburg         Austria         10.0\n",
       "41      42                   Arsenal         England         26.0\n",
       "42      43                   Gr¨ºmio          Brazil          3.0\n",
       "43      44             Flora Tallinn         Estonia          5.0\n",
       "44      45               Racing Club       Argentina         29.0\n",
       "45      46               Southampton         England        180.0\n",
       "46      47      FK Red Star Belgrade          Serbia         10.0\n",
       "47      48                  Flamengo          Brazil          1.0\n",
       "48      49             Internacional          Brazil         19.0\n",
       "49      50                Olympiakos          Greece         42.0"
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>number</th>\n      <th>name</th>\n      <th>contry</th>\n      <th>last_number</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1</td>\n      <td>Bayern M¨¹nchen</td>\n      <td>Germany</td>\n      <td>6.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2</td>\n      <td>Manchester City</td>\n      <td>England</td>\n      <td>1.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>Atl¨¦tico Madrid</td>\n      <td>Spain</td>\n      <td>3.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>4</td>\n      <td>Paris Saint-Germain</td>\n      <td>France</td>\n      <td>1.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>5</td>\n      <td>Real Madrid</td>\n      <td>Spain</td>\n      <td>3.0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>6</td>\n      <td>Liverpool FC</td>\n      <td>England</td>\n      <td>2.0</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>7</td>\n      <td>Barcelona</td>\n      <td>Spain</td>\n      <td>5.0</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>8</td>\n      <td>Inter Milan</td>\n      <td>Italy</td>\n      <td>7.0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>9</td>\n      <td>Juventus</td>\n      <td>Italy</td>\n      <td>8.0</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>10</td>\n      <td>Manchester United</td>\n      <td>England</td>\n      <td>10.0</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>11</td>\n      <td>AC Milan</td>\n      <td>Italy</td>\n      <td>13.0</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>12</td>\n      <td>RasenBallsport Leipzig</td>\n      <td>Germany</td>\n      <td>23.0</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>13</td>\n      <td>Atalanta</td>\n      <td>Italy</td>\n      <td>38.0</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>14</td>\n      <td>FC Porto</td>\n      <td>Portugal</td>\n      <td>3.0</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>15</td>\n      <td>Sevilla</td>\n      <td>Spain</td>\n      <td>3.0</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>16</td>\n      <td>Borussia Dortmund</td>\n      <td>Germany</td>\n      <td>4.0</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>17</td>\n      <td>River Plate</td>\n      <td>Argentina</td>\n      <td>8.0</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>18</td>\n      <td>Bayer Leverkusen</td>\n      <td>Germany</td>\n      <td>21.0</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>19</td>\n      <td>Villarreal</td>\n      <td>Spain</td>\n      <td>40.0</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>20</td>\n      <td>Ajax Amsterdam</td>\n      <td>Netherlands</td>\n      <td>6.0</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>21</td>\n      <td>Tottenham Hotspur</td>\n      <td>England</td>\n      <td>11.0</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>22</td>\n      <td>Chelsea FC</td>\n      <td>England</td>\n      <td>11.0</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>23</td>\n      <td>Shakhtar Donetsk</td>\n      <td>Ukraine</td>\n      <td>2.0</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>24</td>\n      <td>Borussia M?nchengladbach</td>\n      <td>Germany</td>\n      <td>8.0</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>25</td>\n      <td>Roma</td>\n      <td>Italy</td>\n      <td>12.0</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>26</td>\n      <td>SSC Napoli</td>\n      <td>Italy</td>\n      <td>17.0</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>27</td>\n      <td>Leicester City</td>\n      <td>England</td>\n      <td>77.0</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>28</td>\n      <td>Lazio</td>\n      <td>Italy</td>\n      <td>2.0</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>29</td>\n      <td>Lyon</td>\n      <td>France</td>\n      <td>6.0</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>30</td>\n      <td>Santos FC</td>\n      <td>Brazil</td>\n      <td>55.0</td>\n    </tr>\n    <tr>\n      <th>30</th>\n      <td>31</td>\n      <td>Benfica</td>\n      <td>Portugal</td>\n      <td>4.0</td>\n    </tr>\n    <tr>\n      <th>31</th>\n      <td>32</td>\n      <td>Palmeiras</td>\n      <td>Brazil</td>\n      <td>10.0</td>\n    </tr>\n    <tr>\n      <th>32</th>\n      <td>33</td>\n      <td>Slavia Prague</td>\n      <td>Czech Republic</td>\n      <td>38.0</td>\n    </tr>\n    <tr>\n      <th>33</th>\n      <td>34</td>\n      <td>Rangers</td>\n      <td>Scotland</td>\n      <td>134.0</td>\n    </tr>\n    <tr>\n      <th>34</th>\n      <td>35</td>\n      <td>Lille</td>\n      <td>France</td>\n      <td>92.0</td>\n    </tr>\n    <tr>\n      <th>35</th>\n      <td>36</td>\n      <td>Boca Juniors</td>\n      <td>Argentina</td>\n      <td>7.0</td>\n    </tr>\n    <tr>\n      <th>36</th>\n      <td>37</td>\n      <td>Real Sociedad</td>\n      <td>Spain</td>\n      <td>23.0</td>\n    </tr>\n    <tr>\n      <th>37</th>\n      <td>38</td>\n      <td>Eintracht Frankfurt</td>\n      <td>Germany</td>\n      <td>15.0</td>\n    </tr>\n    <tr>\n      <th>38</th>\n      <td>39</td>\n      <td>Al Ahly</td>\n      <td>Egypt</td>\n      <td>51.0</td>\n    </tr>\n    <tr>\n      <th>39</th>\n      <td>40</td>\n      <td>PSV Eindhoven</td>\n      <td>Netherlands</td>\n      <td>21.0</td>\n    </tr>\n    <tr>\n      <th>40</th>\n      <td>41</td>\n      <td>Red Bull Salzburg</td>\n      <td>Austria</td>\n      <td>10.0</td>\n    </tr>\n    <tr>\n      <th>41</th>\n      <td>42</td>\n      <td>Arsenal</td>\n      <td>England</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>42</th>\n      <td>43</td>\n      <td>Gr¨ºmio</td>\n      <td>Brazil</td>\n      <td>3.0</td>\n    </tr>\n    <tr>\n      <th>43</th>\n      <td>44</td>\n      <td>Flora Tallinn</td>\n      <td>Estonia</td>\n      <td>5.0</td>\n    </tr>\n    <tr>\n      <th>44</th>\n      <td>45</td>\n      <td>Racing Club</td>\n      <td>Argentina</td>\n      <td>29.0</td>\n    </tr>\n    <tr>\n      <th>45</th>\n      <td>46</td>\n      <td>Southampton</td>\n      <td>England</td>\n      <td>180.0</td>\n    </tr>\n    <tr>\n      <th>46</th>\n      <td>47</td>\n      <td>FK Red Star Belgrade</td>\n      <td>Serbia</td>\n      <td>10.0</td>\n    </tr>\n    <tr>\n      <th>47</th>\n      <td>48</td>\n      <td>Flamengo</td>\n      <td>Brazil</td>\n      <td>1.0</td>\n    </tr>\n    <tr>\n      <th>48</th>\n      <td>49</td>\n      <td>Internacional</td>\n      <td>Brazil</td>\n      <td>19.0</td>\n    </tr>\n    <tr>\n      <th>49</th>\n      <td>50</td>\n      <td>Olympiakos</td>\n      <td>Greece</td>\n      <td>42.0</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 27
    }
   ],
   "source": [
    "# 俱乐部前50名情况\n",
    "df.head(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "0     6\n",
       "1     1\n",
       "2     3\n",
       "3     1\n",
       "4     3\n",
       "5     2\n",
       "6     5\n",
       "7     7\n",
       "8     8\n",
       "9    10\n",
       "Name: last_number, dtype: int32"
      ]
     },
     "metadata": {},
     "execution_count": 13
    }
   ],
   "source": [
    "#  俱乐部前10名的历史排名\n",
    "df['last_number'].head(10).astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "                contry\n",
       "contry                \n",
       "Argentina            3\n",
       "Austria              1\n",
       "Brazil               5\n",
       "Czech Republic       1\n",
       "Egypt                1\n",
       "England              8\n",
       "Estonia              1\n",
       "France               3\n",
       "Germany              6\n",
       "Greece               1\n",
       "Italy                7\n",
       "Netherlands          2\n",
       "Portugal             2\n",
       "Scotland             1\n",
       "Serbia               1\n",
       "Spain                6\n",
       "Ukraine              1"
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>contry</th>\n    </tr>\n    <tr>\n      <th>contry</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>Argentina</th>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>Austria</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>Brazil</th>\n      <td>5</td>\n    </tr>\n    <tr>\n      <th>Czech Republic</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>Egypt</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>England</th>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>Estonia</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>France</th>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>Germany</th>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>Greece</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>Italy</th>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>Netherlands</th>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>Portugal</th>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>Scotland</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>Serbia</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>Spain</th>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>Ukraine</th>\n      <td>1</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 82
    }
   ],
   "source": [
    "# 查看按国家分类前50的俱乐部情况\n",
    "b = df.head(50).groupby(by=df['contry']).agg({'contry':np.size})\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看前俱乐部按国家地图分布\n",
    "from pyecharts import Map\n",
    "a = df.groupby(by=df['contry']).agg({'contry':np.size})\n",
    "# 获得索引值内容\n",
    "contry_list = a.index.tolist()\n",
    "contry_number_list = a['contry'].tolist()\n",
    "map0 = Map(\"世界地图示例\", width=800, height=400)\n",
    "# 第一种通过实际数值更改地图颜色\n",
    "map0.add(\"世界地图\", contry_list, contry_number_list, maptype=\"world\", visual_range=[1, 15], is_visualmap=True, visual_text_color='#000')\n",
    "# 第二种是对数值进行分类，来更加直观显示地图\n",
    "\n",
    "map0.render(path=\"世界地图.html\")\n",
    "# map0"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.8-candidate"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}